package mobcatservice;

import entidade.AppHelper;
import javax.xml.rpc.JAXRPCException;
import javax.xml.namespace.QName;
import javax.microedition.xml.rpc.Operation;
import javax.microedition.xml.rpc.Type;
import javax.microedition.xml.rpc.ComplexType;
import javax.microedition.xml.rpc.Element;

public class MobCatServiceService_Stub implements MobCatServiceService, javax.xml.rpc.Stub {

    private String[] _propertyNames;
    private Object[] _propertyValues;

    public MobCatServiceService_Stub() {
        _propertyNames = new String[] { ENDPOINT_ADDRESS_PROPERTY };
        _propertyValues = new Object[] { AppHelper.getInstance().resolveIPLocation() };
    }

    public void _setProperty( String name, Object value ) {
        int size = _propertyNames.length;
        for (int i = 0; i < size; ++i) {
            if( _propertyNames[i].equals( name )) {
                _propertyValues[i] = value;
                return;
            }
        }
        String[] newPropNames = new String[size + 1];
        System.arraycopy(_propertyNames, 0, newPropNames, 0, size);
        _propertyNames = newPropNames;
        Object[] newPropValues = new Object[size + 1];
        System.arraycopy(_propertyValues, 0, newPropValues, 0, size);
        _propertyValues = newPropValues;

        _propertyNames[size] = name;
        _propertyValues[size] = value;
    }

    public Object _getProperty(String name) {
        for (int i = 0; i < _propertyNames.length; ++i) {
            if (_propertyNames[i].equals(name)) {
                return _propertyValues[i];
            }
        }
        if (ENDPOINT_ADDRESS_PROPERTY.equals(name) || USERNAME_PROPERTY.equals(name) || PASSWORD_PROPERTY.equals(name)) {
            return null;
        }
        if (SESSION_MAINTAIN_PROPERTY.equals(name)) {
            return new Boolean(false);
        }
        throw new JAXRPCException("Stub does not recognize property: " + name);
    }

    protected void _prepOperation(Operation op) {
        for (int i = 0; i < _propertyNames.length; ++i) {
            op.setProperty(_propertyNames[i], _propertyValues[i].toString());
        }
    }

    public String[] listCidadesPorEstado(String estadoId) throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
            estadoId
        };

        Operation op = Operation.newInstance( _qname_operation_listCidadesPorEstado, _type_listCidadesPorEstado, _type_listCidadesPorEstadoResponse );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }

        String[] _res = new String[((Object [])((Object []) resultObj)[0]).length];
        System.arraycopy(((Object []) resultObj)[0], 0, _res, 0, _res.length);
        return _res;
    }

    public String[] listCategoriasRaizPorCidade(String cidadeId) throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
            cidadeId
        };

        Operation op = Operation.newInstance( _qname_operation_listCategoriasRaizPorCidade, _type_listCategoriasRaizPorCidade, _type_listCategoriasRaizPorCidadeResponse );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }

        String[] _res = new String[((Object [])((Object []) resultObj)[0]).length];
        System.arraycopy(((Object []) resultObj)[0], 0, _res, 0, _res.length);
        return _res;
    }

    public String[] buscarRegistros(String palavraChave, int cidadeId) throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
            palavraChave,
            new Integer(cidadeId)
        };

        Operation op = Operation.newInstance( _qname_operation_buscarRegistros, _type_buscarRegistros, _type_buscarRegistrosResponse );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }

        String[] _res = new String[((Object [])((Object []) resultObj)[0]).length];
        System.arraycopy(((Object []) resultObj)[0], 0, _res, 0, _res.length);
        return _res;
    }

    public String[] listRegistrosPorCategoria(String categoriaId) throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
            categoriaId
        };

        Operation op = Operation.newInstance( _qname_operation_listRegistrosPorCategoria, _type_listRegistrosPorCategoria, _type_listRegistrosPorCategoriaResponse );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }

        String[] _res = new String[((Object [])((Object []) resultObj)[0]).length];
        System.arraycopy(((Object []) resultObj)[0], 0, _res, 0, _res.length);
        return _res;
    }

    public String[] listEstados() throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
        };

        Operation op = Operation.newInstance( _qname_operation_listEstados, _type_listEstados, _type_listEstadosResponse );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }

        String[] _res = new String[((Object [])((Object []) resultObj)[0]).length];
        System.arraycopy(((Object []) resultObj)[0], 0, _res, 0, _res.length);
        return _res;
    }

    public String getCategoria(String categoriaId) throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
            categoriaId
        };

        Operation op = Operation.newInstance( _qname_operation_getCategoria, _type_getCategoria, _type_getCategoriaResponse );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }

        return (String )((Object[])resultObj)[0];
    }

    public String[] getRegistro(String registroId) throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
            registroId
        };

        Operation op = Operation.newInstance( _qname_operation_getRegistro, _type_getRegistro, _type_getRegistroResponse );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }

        String[] _res = new String[((Object [])((Object []) resultObj)[0]).length];
        System.arraycopy(((Object []) resultObj)[0], 0, _res, 0, _res.length);
        return _res;
    }

    public String[] listSubCategorias(String categoriaId) throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
            categoriaId
        };

        Operation op = Operation.newInstance( _qname_operation_listSubCategorias, _type_listSubCategorias, _type_listSubCategoriasResponse );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }

        String[] _res = new String[((Object [])((Object []) resultObj)[0]).length];
        System.arraycopy(((Object []) resultObj)[0], 0, _res, 0, _res.length);
        return _res;
    }

    protected static final QName _qname_operation_listSubCategorias = new QName( "http://ws/", "listSubCategorias" );
    protected static final QName _qname_operation_getRegistro = new QName( "http://ws/", "getRegistro" );
    protected static final QName _qname_operation_getCategoria = new QName( "http://ws/", "getCategoria" );
    protected static final QName _qname_operation_listEstados = new QName( "http://ws/", "listEstados" );
    protected static final QName _qname_operation_listRegistrosPorCategoria = new QName( "http://ws/", "listRegistrosPorCategoria" );
    protected static final QName _qname_operation_buscarRegistros = new QName( "http://ws/", "buscarRegistros" );
    protected static final QName _qname_operation_listCategoriasRaizPorCidade = new QName( "http://ws/", "listCategoriasRaizPorCidade" );
    protected static final QName _qname_operation_listCidadesPorEstado = new QName( "http://ws/", "listCidadesPorEstado" );
    protected static final QName _qname_listSubCategorias = new QName( "http://ws/", "listSubCategorias" );
    protected static final QName _qname_getRegistro = new QName( "http://ws/", "getRegistro" );
    protected static final QName _qname_getCategoriaResponse = new QName( "http://ws/", "getCategoriaResponse" );
    protected static final QName _qname_listEstados = new QName( "http://ws/", "listEstados" );
    protected static final QName _qname_getCategoria = new QName( "http://ws/", "getCategoria" );
    protected static final QName _qname_listRegistrosPorCategoria = new QName( "http://ws/", "listRegistrosPorCategoria" );
    protected static final QName _qname_listSubCategoriasResponse = new QName( "http://ws/", "listSubCategoriasResponse" );
    protected static final QName _qname_buscarRegistros = new QName( "http://ws/", "buscarRegistros" );
    protected static final QName _qname_listCategoriasRaizPorCidade = new QName( "http://ws/", "listCategoriasRaizPorCidade" );
    protected static final QName _qname_listCidadesPorEstado = new QName( "http://ws/", "listCidadesPorEstado" );
    protected static final QName _qname_listCategoriasRaizPorCidadeResponse = new QName( "http://ws/", "listCategoriasRaizPorCidadeResponse" );
    protected static final QName _qname_getRegistroResponse = new QName( "http://ws/", "getRegistroResponse" );
    protected static final QName _qname_listEstadosResponse = new QName( "http://ws/", "listEstadosResponse" );
    protected static final QName _qname_buscarRegistrosResponse = new QName( "http://ws/", "buscarRegistrosResponse" );
    protected static final QName _qname_listCidadesPorEstadoResponse = new QName( "http://ws/", "listCidadesPorEstadoResponse" );
    protected static final QName _qname_listRegistrosPorCategoriaResponse = new QName( "http://ws/", "listRegistrosPorCategoriaResponse" );
    protected static final Element _type_listCidadesPorEstado;
    protected static final Element _type_getCategoriaResponse;
    protected static final Element _type_getCategoria;
    protected static final Element _type_listCategoriasRaizPorCidade;
    protected static final Element _type_listSubCategorias;
    protected static final Element _type_buscarRegistrosResponse;
    protected static final Element _type_listRegistrosPorCategoria;
    protected static final Element _type_listCategoriasRaizPorCidadeResponse;
    protected static final Element _type_buscarRegistros;
    protected static final Element _type_listCidadesPorEstadoResponse;
    protected static final Element _type_listEstadosResponse;
    protected static final Element _type_getRegistro;
    protected static final Element _type_listEstados;
    protected static final Element _type_listRegistrosPorCategoriaResponse;
    protected static final Element _type_listSubCategoriasResponse;
    protected static final Element _type_getRegistroResponse;

    static {
        _type_listSubCategorias = new Element( _qname_listSubCategorias, _complexType( new Element[] {
            new Element( new QName( "", "categoriaId" ), Type.STRING, 0, 1, false )}), 1, 1, false );
        _type_getRegistro = new Element( _qname_getRegistro, _complexType( new Element[] {
            new Element( new QName( "", "registroId" ), Type.STRING, 0, 1, false )}), 1, 1, false );
        _type_getCategoriaResponse = new Element( _qname_getCategoriaResponse, _complexType( new Element[] {
            new Element( new QName( "", "return" ), Type.STRING, 0, 1, false )}), 1, 1, false );
        _type_listEstados = new Element( _qname_listEstados, _complexType( new Element[] {
        }), 1, 1, false );
        _type_getCategoria = new Element( _qname_getCategoria, _complexType( new Element[] {
            new Element( new QName( "", "categoriaId" ), Type.STRING, 0, 1, false )}), 1, 1, false );
        _type_listRegistrosPorCategoria = new Element( _qname_listRegistrosPorCategoria, _complexType( new Element[] {
            new Element( new QName( "", "categoriaId" ), Type.STRING, 0, 1, false )}), 1, 1, false );
        _type_listSubCategoriasResponse = new Element( _qname_listSubCategoriasResponse, _complexType( new Element[] {
            new Element( new QName( "", "return" ), Type.STRING, 0, Element.UNBOUNDED, true )}), 1, 1, false );
        _type_buscarRegistros = new Element( _qname_buscarRegistros, _complexType( new Element[] {
            new Element( new QName( "", "palavraChave" ), Type.STRING, 0, 1, false ),
            new Element( new QName( "", "cidadeId" ), Type.INT )}), 1, 1, false );
        _type_listCategoriasRaizPorCidade = new Element( _qname_listCategoriasRaizPorCidade, _complexType( new Element[] {
            new Element( new QName( "", "cidadeId" ), Type.STRING, 0, 1, false )}), 1, 1, false );
        _type_listCidadesPorEstado = new Element( _qname_listCidadesPorEstado, _complexType( new Element[] {
            new Element( new QName( "", "estadoId" ), Type.STRING, 0, 1, false )}), 1, 1, false );
        _type_listCategoriasRaizPorCidadeResponse = new Element( _qname_listCategoriasRaizPorCidadeResponse, _complexType( new Element[] {
            new Element( new QName( "", "return" ), Type.STRING, 0, Element.UNBOUNDED, true )}), 1, 1, false );
        _type_getRegistroResponse = new Element( _qname_getRegistroResponse, _complexType( new Element[] {
            new Element( new QName( "", "return" ), Type.STRING, 0, Element.UNBOUNDED, true )}), 1, 1, false );
        _type_buscarRegistrosResponse = new Element( _qname_buscarRegistrosResponse, _complexType( new Element[] {
            new Element( new QName( "", "return" ), Type.STRING, 0, Element.UNBOUNDED, true )}), 1, 1, false );
        _type_listEstadosResponse = new Element( _qname_listEstadosResponse, _complexType( new Element[] {
            new Element( new QName( "", "return" ), Type.STRING, 0, Element.UNBOUNDED, true )}), 1, 1, false );
        _type_listCidadesPorEstadoResponse = new Element( _qname_listCidadesPorEstadoResponse, _complexType( new Element[] {
            new Element( new QName( "", "return" ), Type.STRING, 0, Element.UNBOUNDED, true )}), 1, 1, false );
        _type_listRegistrosPorCategoriaResponse = new Element( _qname_listRegistrosPorCategoriaResponse, _complexType( new Element[] {
            new Element( new QName( "", "return" ), Type.STRING, 0, Element.UNBOUNDED, true )}), 1, 1, false );
    }

    private static ComplexType _complexType( Element[] elements ) {
        ComplexType result = new ComplexType();
        result.elements = elements;
        return result;
    }
}
